package Prototype;
//具体原型类
class Realizetype implements Cloneable{
    Realizetype(){
        System.out.println("创建具体原型成功！");
    }
    public Object clone(){
        System.out.println("具体原型复制成功！");
        try {
            return (Realizetype)super.clone();
        }catch (CloneNotSupportedException e){
            e.printStackTrace();
        }
        return null;
    }
}
//原型模测试类
public class PrototypeTest {
    public static void main(String[] args) {
        Realizetype obj1 = new Realizetype();
        Realizetype obj2 = (Realizetype)obj1.clone();
        System.out.println("obj1 = obj2?"+(obj1==obj2));
    }
}
